package com.ruoyi.store.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.store.mapper.StoCategoryMapper;
import com.ruoyi.store.domain.StoCategory;
import com.ruoyi.store.service.IStoCategoryService;

/**
 * 菜品分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-05
 */
@Service
public class StoCategoryServiceImpl implements IStoCategoryService 
{
    @Autowired
    private StoCategoryMapper stoCategoryMapper;

    /**
     * 查询菜品分类
     * 
     * @param id 菜品分类主键
     * @return 菜品分类
     */
    @Override
    public StoCategory selectStoCategoryById(Long id)
    {
        return stoCategoryMapper.selectStoCategoryById(id);
    }

    /**
     * 查询菜品分类列表
     * 
     * @param stoCategory 菜品分类
     * @return 菜品分类
     */
    @Override
    public List<StoCategory> selectStoCategoryList(StoCategory stoCategory)
    {
        return stoCategoryMapper.selectStoCategoryList(stoCategory);
    }

    /**
     * 新增菜品分类
     * 
     * @param stoCategory 菜品分类
     * @return 结果
     */
    @Override
    public int insertStoCategory(StoCategory stoCategory)
    {
        stoCategory.setCreateTime(DateUtils.getNowDate());
        return stoCategoryMapper.insertStoCategory(stoCategory);
    }

    /**
     * 修改菜品分类
     * 
     * @param stoCategory 菜品分类
     * @return 结果
     */
    @Override
    public int updateStoCategory(StoCategory stoCategory)
    {
        stoCategory.setUpdateTime(DateUtils.getNowDate());
        return stoCategoryMapper.updateStoCategory(stoCategory);
    }

    /**
     * 批量删除菜品分类
     * 
     * @param ids 需要删除的菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteStoCategoryByIds(Long[] ids)
    {
        return stoCategoryMapper.deleteStoCategoryByIds(ids);
    }

    /**
     * 删除菜品分类信息
     * 
     * @param id 菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteStoCategoryById(Long id)
    {
        return stoCategoryMapper.deleteStoCategoryById(id);
    }
}
